Skip to content

fix: forget to call continuation.finish() causing task suspension#16

Merged
Recouse merged 2 commits into
Recouse:mainfrom
random-yang:fix/continuation
Oct 3, 2024
Merged

fix: forget to call continuation.finish() causing task suspension#16
Recouse merged 2 commits into
Recouse:mainfrom
random-yang:fix/continuation

Conversation

@random-yang
Copy link
Copy Markdown
Contributor

import EventSource

let eventSource = EventSource()
let dataTask = eventSource.dataTask(for: urlRequest)

for await event in dataTask.events() {
}

// Code blow will never be fired.
// And it will lead to memory leaks.
print("finish") // will not fire

@Recouse
Copy link
Copy Markdown
Owner

Recouse commented Sep 30, 2024

Hey! Thanks for the PR. I'll check it out and merge ASAP

@Recouse Recouse self-assigned this Sep 30, 2024
Comment thread Sources/EventSource/EventSource.swift Outdated
@Recouse
Copy link
Copy Markdown
Owner

Recouse commented Oct 3, 2024

Thank you for the change. During testing, I caught a bug: EventType.closed is never sent on errors. I’ll merge this for now and will fix the bug after the merge

@Recouse Recouse merged commit 1cc171d into Recouse:main Oct 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants